package zhibi.plugin.image.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created by 执笔 on 2016/12/30.
 * 图片工具类
 */
public class ImageUtil {

    /**
     * 根据文件名判断文件是不是图片
     * @param fileName
     * @return
     */
    public static boolean isImg(String fileName){
        Pattern p = Pattern.compile("^(jpeg|jpg|png|gif|bmp|webp)");
        Matcher m = p.matcher(fileName.substring(fileName.lastIndexOf(".") + 1 ));
        if (m.find()) {
            return true;
        }
        return false;
    }
}
